//联动查询省市区
$('.province').on('change', function() {
	let id = $(this).val();
	if(id.length===0){
		$(".city").html("<option value=''>请选择</option>");
		$(".county").html("<option value=''>请选择</option>");
		return false;
	}
	area(id,'.city');
})

$('.city').on('change', function() {
	let id = $(this).val();
	if(id.length===0){
		$(".county").html("<option value=''>请选择</option>");
		return false;
	}
	area(id,'.county');
})

function area(id,position){
	let res = request("/fore/address/childrenArea",{"id": id})
	let option = "<option value=''>请选择</option>"
	if(res.code === 0){
		let data =res.data;
		for(let i=0;i<data.length;i++){
			let area = data[i];
			option += "<option value='" + area.id + "'>" + area.name + "</option>";
		}
	}
	$(position).html(option);
}
